/**
 *
 * @author zzhijie
 * @date 2021-05-25
 */
const columnMap = new Map();
/**
 *
 * @param data
 * @return {function(...[*]=)}
 * @constructor
 */
export const Col = data => (target, key) => {
  let {constructor} = target;
  let targetClass = columnMap.get(constructor);
  if (!targetClass) columnMap.set(constructor, targetClass = []);
  data.field = key;
  targetClass.push(data);
};
export const Search = data => (target, key) => {
  let {constructor} = target;
  let targetClass = columnMap.get(constructor);
  if (!targetClass) columnMap.set(constructor, targetClass = []);
  data.field = key;
  targetClass.push(data);
};
export const ColumnBuilder = (target, key, descriptor) => {
  descriptor.value = function (entity) {
    console.log(entity.constructor);
    let val = columnMap.get(entity.constructor);
    console.log(val);
  }
}
export const Table = target => {
  console.log(123)
  target.buildColumn = function () {
    return columnMap.get(target);
  }
}
